﻿@namespace MudBlazor.UnitTests.TestComponents

<MudButton OnClick="AddTab">Add Tab</MudButton>
<MudButton OnClick="RemoveLast">Remove Last</MudButton>

<MudTabs Elevation="1">
    @foreach (var tab in _tabs)
    {
        <MudTabPanel Text="@tab">
            <MudText>@tab</MudText>
        </MudTabPanel>
    }    
</MudTabs>

@code
{
    public static string __description__ = "Adding and removing tabs should work";

    private List<string> _tabs = new List<string>();
    private int i = 0;

    private void AddTab()
    {
        _tabs.Add($"Tab {i++}");
    }

    private void RemoveLast()
    {
        if(_tabs.Any())
            _tabs.RemoveAt(_tabs.Count-1);
    }
}
